<?php
namespace Orm\Product;

class ProductModel extends \Base\BaseOrmModel{

    function __construct()
    {
        parent::__construct();
        $this->table = 't_product';
    }

    /**
     * @param $type
     * @return array
     */
    public function getProductListByType($type){
        if($type == '1'){
            $sql= "SELECT `id`,`name`,`portrait`,total_num,residue_num FROM ".$this->table." WHERE is_del = 0  AND `type` = ".$type;
        }else{
            $sql= "SELECT `id`,`name`,`portrait`,total_num FROM ".$this->table." WHERE is_del = 0  AND `type` <> 1 ORDER BY total_num ASC ";
        }
        return $this->_fetch($sql,1);
    }
}